<?
    function parseHeader($strHeader=false)
    {
        // ------------
        // declarations
        // ------------
        $aTemp = array();
        $aTempTwo = array();
        $headerFields = array();
        
        if (!$strHeader) die (false);
        
        // --------------
        // Header parsing
        // --------------
        $strHeader = trim($strHeader);
        $aTemp = explode("\n",$strHeader);
        foreach ($aTemp as $field)
        {
            $aTempTwo = explode(':',$field);
            if (isset($aTempTwo[1]) && !empty($aTempTwo[1]))
            {
                $hContent = $aTempTwo[1];
            }
            else
            {
                $hContent = '';
            }
            $headerFields[$aTempTwo[0]] = $hContent;
            unset ($aTempTwo);
        }
        
        return $headerFields;
    }
    
    
    function rss091($articles)
    {
        // Declarations
        $strRSS = '';
        
        // Building CHANNEL
        $strRSS .= '<?xml version="1.0" encoding="ISO-8859-1" ?>';
        $strRSS .= '<rss version="0.91">';
        $strRSS .= '<channel>';
        $strRSS .= "<title></title>";
        $strRSS .= "<link></link>";
        $strRSS .= "<description>nntp to rss bridge</description>";
        $strRSS .= "<language>fr</language>";
        $strRSS .= "<copyright>CreativeCommons</copyright>";
        $strRSS .= "<managingEditor>stan@extramuros.com</managingEditor>";
        $strRSS .= "<webMaster>stan@extramuros.com</webMaster>";
        
        // Building items
        foreach($articles as $article)
        {
            $title = $article['header']['Subject'];
            $author = $article['header']['From'];
            $abstract = substr($article['body'],0,150);
            
            $abstract = str_replace('>','&gt;',$abstract);
            $abstract = str_replace('<','&lt;',$abstract);
            $abstract = nl2br($abstract);
            
            $author = str_replace('>',']',$author);
            $author = str_replace('<','[',$author);
            
            $strRSS .= '<item>';
                $strRSS .= "<title>$title</title>";
                $strRSS .= "<link></link>";
                $strRSS .= "<description>$author <br /> $abstract (...)</description>";
            $strRSS .= '</item>';
        }
        
        // Closing the file
        $strRSS .= '</channel>';
        $strRSS .= '</rss>';
        
        return $strRSS;
    }
    
    function buildRSSv200channel($channelValues=false)
    {
        if (!$channelValues) return false
        
        
    }
?>